import fetch from 'utils/fetch';
/* 卡片管理*/

// 1.分页查询学生考勤卡
export function queryStudentCard( page, rows, fSchoolId, provinceId, cityId, areaId, fClassId, sCardNumber, userName ) {
    const data = {
        page,
        rows,
        fSchoolId,
        provinceId,
        cityId,
        areaId,
        fClassId,
        sCardNumber,
        userName
    };
    return fetch({
        url: '/card/queryStudentCard/' + page+ '/' +rows,
        method: 'post',
        data
    });
}

// 2.分页查询教师考勤卡
export function queryTeacherCard( page, rows, fSchoolId, provinceId, cityId, areaId, sCardNumber, userName ) {
    const data = {
        page,
        rows,
        fSchoolId,
        provinceId,
        cityId,
        areaId,
        sCardNumber,
        userName
    };
    return fetch({
        url: '/card/queryTeacherCard/' + page + '/' + rows,
        method: 'post',
        data
    });
}

//3.绑定卡
export function insertCard(sCardNumber, fUserId, fSchoolId, sCardType, fRelationId, sSchoolName, sType) {
    const data = {
        sCardNumber,
        fUserId,
        fSchoolId,
        sCardType,
        fRelationId,
        sSchoolName,
        sType
    };
    return fetch({
        url: '/card/insertCard',
        method: 'post',
        data
    });
}

//4.设置一卡通
export function updateIdCard(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/card/updateIdCard',
        method: 'post',
        data
    });
}

//5.解绑
export function deleteCard(sCardNumber) {
    const data = {
        sCardNumber
    };
    return fetch({
        url: '/card/deleteCard',
        method: 'post',
        data
    });
}

//6.批量解绑
export function batchDeleteCard(cardNumList) {
    const data = {
        cardNumList
    };
    return fetch({
        url: '/card/batchDeleteCard',
        method: 'post',
        data
    });
}

//7.导出班级信息模板
export function expotClassInfo(token, classId, schoolName, className) {
    const data = {
        token,
        classId,
        schoolName,
        className
    };
    return fetch({
        url: '/card/expotClassInfo',
        method: 'post',
        data
    });
}

// 8.导入学生卡
export function importStudentCard( fSchoolId, fClassId ) {
    const data = {
        fSchoolId,
        fClassId
    };
    return fetch({
        url: '/card/importStudentCard',
        method: 'post',
        data
    });
}

// 导入学生卡轮询
export function importStudentCardProgress( timeStamp, classId ) {
    const data = {
        timeStamp,
        classId
    };
    return fetch({
        url: '/card/importStudentCardProgress',
        method: 'post',
        data
    });
}

// 9.导出教师信息模板
export function expotTeacherInfo( token, schoolName, className ) {
    const data = {
        token,
        schoolName,
        className
    };
    return fetch({
        url: '/card/expotTeacherInfo',
        method: 'post',
        data
    });
}

// 10.导出教师卡
export function importTeacherCard( fSchoolId ) {
    const data = {
        fSchoolId
    };
    return fetch({
        url: '/card/importTeacherCard',
        method: 'post',
        data
    });
} 

// 导出教师卡轮询
export function importTeacherCardProgress( timeStamp,schoolId ) {
    const data = {
        timeStamp,
        schoolId
    };
    return fetch({
        url: '/card/importTeacherCardProgress',
        method: 'post',
        data
    });
} 

// 导出教师卡轮询
export function importTeacherVirtualCardProgress( timeStamp,schoolId ) {
    const data = {
        timeStamp,
        schoolId
    };
    return fetch({
        url: '/card/importTeacherVirtualCardProgress',
        method: 'post',
        data
    });
} 

// 查询学校
export function getSchoolList( schoolName ) {
    const data = {
        schoolName
    };
    return fetch({
        url: '/card/listSchoolByName',
        method: 'post',
        data
    });
}

// 23.根据学校id查询年级(代理商)
export function getGrade( fSchoolId ) {
    const data = {
        fSchoolId
    };
    return fetch({
        url: '/card/getGradeBySchoolId',
        method: 'post',
        data
    });
}

// 24.根据学校id和年级获取班级列表(代理商)
export function getClass( fSchoolId,fGrade ) {
    const data = {
        fSchoolId,
        fGrade
    };
    return fetch({
        url: '/card/getClassByGrade',
        method: 'post',
        data
    });
}

// 25.根据班级id获取班级学生(经销商)
export function getStudentByClass( fClassId,userName ) {
    const data = {
        fClassId,
        userName
    };
    return fetch({
        url: '/card/getStudentByClass',
        method: 'post',
        data
    });
}

// 26.根据学校id查询教师列表(经销商)
export function getTeacherList( fSchoolId,userName ) {
    const data = {
        fSchoolId,
        userName
    };
    return fetch({
        url: '/card/getTeacherList',
        method: 'post',
        data
    });
}

// 27.查询家长关系(经销商)
export function listSysDictByType() {
    const data = {
    };
    return fetch({
        url: '/card/listSysDictByType',
        method: 'post',
        data
    });
}

// 35.学生卡导入前的数据校验(agent)
export function verifyStudentCardForImport( fSchoolId, fClassId, filePath, sSchoolName ) {
    const data = {
        fSchoolId,
        fClassId,
        filePath,
        sSchoolName
    };
    return fetch({
        url: '/card/verifyStudentCardForImport',
        method: 'post',
        data
    });
}

// 36.教师卡导入前的数据校验 (agent)
export function verifyTeacherCardForImport( fSchoolId, filePath, sSchoolName ) {
    const data = {
        fSchoolId,
        filePath,
        sSchoolName
    };
    return fetch({
        url: '/card/verifyTeacherCardForImport',
        method: 'post',
        data
    });
}

// 6.分页查询教师考勤卡(代理商)
export function queryAdministratorsCard( page, rows, fSchoolId, provinceId, cityId, areaId, sCardNumber ) {
    const data = {
        page, 
        rows, 
        fSchoolId,
        provinceId,
        cityId,
        areaId,
        sCardNumber
    };
    return fetch({
        url: '/card/queryAdministratorsCard/' + page+ '/' +rows,
        method: 'post',
        data
    });
}

// 7.绑定卡(代理商)
export function insertAdminCard( sCardNumber, fSchoolId, sCardType, fRelationId, sSchoolName, sType ) {
    const data = {
        sCardNumber,
        fSchoolId,
        sCardType,
        fRelationId,
        sSchoolName,
        sType
    };
    return fetch({
        url: '/card/insertCard',
        method: 'post',
        data
    });
}

// 8.解绑(代理商)
export function deleteAdminCard( sCardNumber ) {
    const data = {
        sCardNumber
    };
    return fetch({
        url: '/card/deleteCard',
        method: 'post',
        data
    });
}

// 查询学校
// export function getSchoolList(schoolName) {
//     const data = {
//         schoolName
//     };
//     return fetch({
//         url: '/school/listSchoolByName',
//         method: 'post',
//         data
//     });
// }

// 查询班级
// export function queryClassBySchool(schoolId) {
//     const data = {
//         schoolId
//     };
//     return fetch({
//         url: '/class/getClassListBySchoolId',
//         method: 'post',
//         data
//     });
// }

// 查询学校
export function listSchoolByArea( provinceId, cityId, areaId ) {
    const data = {
        provinceId, 
        cityId, 
        areaId
    };
    return fetch({
        url: '/school/listSchool',
        method: 'post',
        data
    });
}

// 学生批量绑卡
export function verifyClassStudent( token, classId ) {
    const data = {
        token,
        classId
    };
    return fetch({
        url: '/card/verifyClassStudent',
        method: 'post',
        data
    });
}

// 教师批量绑卡
export function verifySchoolTeacher( token, schoolId ) {
    const data = {
        token,
        schoolId
    };
    return fetch({
        url: '/card/verifySchoolTeacher',
        method: 'post',
        data
    });
}

// 1.获取虚拟卡号
export function getVirtualCard(fSchoolId, fUserId, sType) {
    const data = {
        fSchoolId,
        fUserId,
        sType
    };
    return fetch({
        url: '/card/getVirtualCard',
        method: 'post',
        data
    });
}

// 2.导入学生虚拟卡
export function importStudentVirtualCard(fSchoolId, fClassId, sSchoolName) {
    const data = {
        fSchoolId,
        fClassId,
        sSchoolName
    };
    return fetch({
        url: '/card/importStudentVirtualCard',
        method: 'post',
        data
    });
}

// 导入学生虚拟卡轮询
export function importStudentVirtualCardProgress(timeStamp, schoolId, classId) {
    const data = {
        timeStamp,
        schoolId,
        classId
    };
    return fetch({
        url: '/card/importStudentVirtualCardProgress',
        method: 'post',
        data
    });
}

// 3.导入教师虚拟卡
export function importTeacherVirtualCard(fSchoolId, sSchoolName) {
    const data = {
        fSchoolId,
        sSchoolName
    };
    return fetch({
        url: '/card/importTeacherVirtualCard',
        method: 'post',
        data
    });
}

// 4.导出学生卡
export function exportStudentCard(token, fSchoolId, sSchoolName, classId, className, cardType) {
    const data = {
        token,
        fSchoolId,
        sSchoolName,
        classId,
        className,
        cardType
    };
    return fetch({
        url: '/card/exportStudentCard',
        method: 'post',
        data
    });
}

// 5.导出教师卡
export function exportTeacherCard(token, fSchoolId, sSchoolName, cardType) {
    const data = {
        token,
        fSchoolId,
        sSchoolName,
        cardType
    };
    return fetch({
        url: '/card/exportTeacherCard',
        method: 'post',
        data
    });
}

// 6.查询学校列表
export function listSchool() {
    const data = {
    };
    return fetch({
        url: '/card/listSchool',
        method: 'post',
        data
    });
}

// 7.检验学生绑卡人数
export function verifyStudentVirtualCard(fSchoolId, fClassId, sCardType) {
    const data = {
        fSchoolId,
        fClassId,
        sCardType
    };
    return fetch({
        url: '/card/verifyStudentVirtualCard',
        method: 'post',
        data
    });
}

// 8.检验教师绑卡人数
export function verifyTeacherVirtualCard(fSchoolId, sCardType) {
    const data = {
        fSchoolId,
        sCardType
    };
    return fetch({
        url: '/card/verifyTeacherVirtualCard',
        method: 'post',
        data
    });
}